import {url} from './index';
import axios from 'axios';


export const  stuList = async () => {
    let result = await axios({
        method:'get',
        url:url+'/students/getAllStu',
        params:{}
    })
    return result.data;
}
export const  deleteStu = async (stuId) => {
    let result = await axios({
        method:'post',
        url:url+'/students/deleteStudent',
        data:{
            stuId
        }
    })
    return result.data;
}
export const  addStu = async (data) => {
    let result = await axios({
        method:'post',
        url:url+'/students/addstudent',
        data
    })
    return result.data;
}
export const  search = async (data) => {
    let result = await axios({
        method:'get',
        url:url+'/students/searchStu',
        params:data
    })
    return result.data;
}
export const  updateStu = async (data) => {
    let result = await axios({
        method:'put',
        url:url+`/students/updateStudent/${data._id}`,
        data:{
            name:data.name,
            age:data.age,
            gender:data.gender
        }
    })
    return result.data;
}
